<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head lang="en">
		<meta charset="utf-8" />
		<title>最家</title>
		<link rel="stylesheet" type="text/css" href="../../css/public.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/myorder.css" />
	</head>
	<body>
		<!------------------------------head------------------------------>
		<div th:replace="~{front/public/topmargin::topbar}"></div>

		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="#" class="fl">首页</a>
				<span>/</span>
				<a href="mygxin">个人中心</a>
				<span>/</span>
				<a href="myorderq" class="on">我的订单</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div class="zuo fl">
					<h3>
						<a href="#"><img id="img-avatar" src="../../img/tx.png" width="90px" height="90px"/></a>
						<p class="clearfix"><span type="text" class="fl" style="font-size: 15px" id="usernameDouble"></span><span  class="fr"  ><a th:href="@{/front/logout}"  >[退出登录]</a></span></p>
					</h3>
					<div>
						<h4>我的交易</h4>
						<ul>
							<li><a href="cart">我的购物车</a></li>
							<li><a href="myorderq">我的订单</a></li>
							<li><a href="myprod">评价晒单</a></li>
						</ul>
						<h4>个人中心</h4>
						<ul>
							<li><a href="mygxin">我的中心</a></li>
							<li><a href="address">地址管理</a></li>
						</ul>
						<h4>账户管理</h4>
						<ul>
							<li  class="on"><a href="mygrxx">个人信息</a></li>
							<li><a href="remima">修改密码</a></li>
						</ul>
					</div>
				</div>
				<div class="you fl">
					<div class="my clearfix">
						<h2 class="fl">我的订单</h2>
						<a href="#" class="fl">请谨防钓鱼链接或诈骗电话，了解更多&gt;</a>
					</div>
					<div class="dlist clearfix">
						<ul class="fl clearfix" id="wa">
							<li class="on"><a href="#2" id="allOrdersA">全部有效订单</a></li>
<!--							<li><a href="#2" id="waitToPayA">待支付</a></li>-->
							<li><a href="#2" id="waitToPayA">待支付</a></li>
							<li><a href="#2l" id="waitToReceiveA">待收货</a></li>
							<li><a href="#" id="alreadyReceiveA">已收货</a></li>
							<li><a href="#" id="notSendA">未发货</a></li>
							<li><a href="#2" id="closeA">已关闭</a></li>
						</ul>
						<form action="#" method="get" class="fr clearfix">
							<input type="text" name="" id="none" value="" placeholder="请输入商品名称、订单号" />
							<input type="button" name="" id="null" value="" />
						</form>
					</div>
					<div class="dkuang clearfix deng notSendDiv" id="notSendDiv" th:if="${order.status}==2" th:each="order,orderStat:${orders}">
						<p class="one fl">未发货</p>
						<div  class="clearfix">
							<div class="fl vewwl">
								<a href="wuliu" class="ckwl">查看物流</a>
								<div class="wuliu">
									<h4>暂未发货，卖家已快马加鞭催促物流发货啦！！！</h4>
								</div>
							</div>
						</div>
						<div class="word clearfix">
							<ul class="fl clearfix">
								<li th:text="${#dates.format(order.getCreateTime(),'yyyy-MM-dd HH:mm')}">2016年12月1日 18:53</li>
								<li th:text="${order.getReceiverName()}">杨小黄</li>
								<li>订单号:[[${order.getOrderId()}]]</li>
								<li>在线支付</li>
							</ul>
							<p class="fr">订单金额：<span th:text="${order.getTotalPrice()}">99.00</span>元</p>
						</div>
						<div class="shohou clearfix">
							<a href="#" class="fl"><img src="../../img/g1.jpg"/></a>
							<p class="fl"><a href="#">收货地址：</a>
								<a href="#">[[${order.getReceiverProvince()}]]&nbsp;[[${order.getReceiverCity()}]]&nbsp;&nbsp;&nbsp;[[${order.getReceiverArea()}]]&nbsp;&nbsp;[[${order.getReceiverAddress()}]]</a></p>
							<div style="display: none"> [[${order.getOrderId()}]]</div>
							<p class="fr">
								<!--								<a href="#" class="confirmReceive">确认收货</a>-->
								<a href="#" class="remindToSend">提醒发货</a>
								<a href="#" class="toorderxq">订单详情</a>
							</p>
						</div>
					</div>
					<div class="dkuang deng waitToPayDiv" id="waitToPayDiv" th:if="${order.status}==1" th:each="order,orderStat:${orders}">
						<p class="one">待支付</p>
						<div class="word clearfix">
							<ul class="fl clearfix">
								<li th:text="${#dates.format(order.getCreateTime(),'yyyy-MM-dd HH:mm')}">2016年12月1日 18:53</li>
								<li th:text="${order.getReceiverName()}">杨小黄</li>
								<li>订单号:[[${order.getOrderId()}]]</li>
								<li>在线支付</li>
							</ul>
							<p class="fr">订单金额：<span th:text="${order.getTotalPrice()}">99.00</span>元</p>
						</div>
						<div class="shohou clearfix">
							<a href="#" class="fl"><img src="../../img/g1.jpg"/></a>
<!--							<p class="fl"><a href="#">家用创意菜盘子圆盘 釉下彩复古</a><a href="#">¥99.00×1</a></p>-->
							<p class="fl">
								<a href="#">收货地址：</a>
								<a href="#">[[${order.getReceiverProvince()}]]&nbsp;[[${order.getReceiverCity()}]]&nbsp;&nbsp;&nbsp;[[${order.getReceiverArea()}]]&nbsp;&nbsp;[[${order.getReceiverAddress()}]]</a>
							</p>
							<div style="display: none"> [[${order.getOrderId()}]]</div>
							<p class="fr">
								<a href="#" class="toPay">立即支付</a>
<!--								<a href="orderxq">订单详情</a>-->
								<a href="#" class="toorderxq">订单详情</a>
							</p>
						</div>
					</div>
					<div class="dkuang alreadyReceiveDiv" id="alreadyReceiveDiv" th:if="${order.status==4}" th:each="order,orderStat:${orders}">
						<p class="one">已收货</p>
						<div class="word clearfix">
							<ul class="fl clearfix">
<!--								<li th:text="${order.getCreateTime()}">2016年12月1日 18:53</li>-->
								<li th:text="${#dates.format(order.getCreateTime(),'yyyy-MM-dd HH:mm')}">2016年12月1日 18:53</li>
								<li th:text="${order.getReceiverName()}">杨小黄</li>
								<li >订单号:[[${order.getOrderId()}]]</li>
								<li>在线支付</li>
							</ul>
							<p class="fr">订单金额：<span th:text="${order.getTotalPrice()}">99.00</span>元</p>
						</div>
						<div class="shohou clearfix">
							<a href="#" class="fl"><img src="../../img/g1.jpg"/></a>
							<p class="fl"><a href="#">收货地址：</a>
								<a href="#">[[${order.getReceiverProvince()}]]&nbsp;[[${order.getReceiverCity()}]]&nbsp;&nbsp;&nbsp;[[${order.getReceiverArea()}]]&nbsp;&nbsp;[[${order.getReceiverAddress()}]]</a></p>
							<div style="display: none"> [[${order.getOrderId()}]]</div>
							<p class="fr">
								<a href="myprod">待评价</a>
								<a href="#" class="toorderxq">订单详情</a>
							</p>
						</div>
					</div>
					<div class="dkuang clearfix deng waitToReceiveDiv" id="waitToReceiveDiv" th:if="${order.status}==3" th:each="order,orderStat:${orders}">
						<p class="one fl">待收货</p>
						<div  class="clearfix">
							<div class="fl vewwl">
								<a href="wuliu" class="ckwl">查看物流</a>
								<div class="wuliu">
									<h4>圆通速递：858888888888888</h4>
									<ul>
										<li>
											<p>妥投投递并签收，已签收。签收人：本人签收</p>
											<p >2016-12-03 17:30:00</p>
										</li>
										<li>
											<p>深圳市南油速递营销部安排投递（投递员姓名：六六六。联系电话：14243452522;</p>
											<p>2016-12-03 08:50:00</p>
										</li>
										<li>
											<p>到达广东省邮政速递物流有限公司深圳航空邮件处理中心处理中心（经转）</p>
											<p>2016-12-03 02:20:00</p>
										</li>
										<li>以上为最新跟踪信息<a href="wuliu">查看全部</a></li>
									</ul>
								</div>
							</div>
						</div>
						<div class="word clearfix">
							<ul class="fl clearfix">
								<li th:text="${#dates.format(order.getCreateTime(),'yyyy-MM-dd HH:mm')}">2016年12月1日 18:53</li>
								<li th:text="${order.getReceiverName()}">杨小黄</li>
								<li>订单号:[[${order.getOrderId()}]]</li>
								<li>在线支付</li>
							</ul>
							<p class="fr">订单金额：<span th:text="${order.getTotalPrice()}">99.00</span>元</p>
						</div>
						<div class="shohou clearfix">
							<a href="#" class="fl"><img src="../../img/g1.jpg"/></a>
							<p class="fl"><a href="#">收货地址：</a>
								<a href="#">[[${order.getReceiverProvince()}]]&nbsp;[[${order.getReceiverCity()}]]&nbsp;&nbsp;&nbsp;[[${order.getReceiverArea()}]]&nbsp;&nbsp;[[${order.getReceiverAddress()}]]</a></p>
							<div style="display: none"> [[${order.getOrderId()}]]</div>
							<p class="fr">
<!--								<a href="#" class="confirmReceive">确认收货</a>-->
								<a href="#" class="confirmReceive">确认收货</a>
<!--								<a href="orderxq">订单详情</a>-->
								<a href="#" class="toorderxq">订单详情</a>
							</p>
						</div>
					</div>

					<div class="dkuang closeDiv" id="closeDiv" th:if="${order.status}==0" th:each="order,orderStat:${orders}">
						<p class="one">已关闭</p>
						<div class="word clearfix">
							<ul class="fl clearfix">
								<li th:text="${#dates.format(order.getCreateTime(),'yyyy-MM-dd HH:mm')}">2016年12月1日 18:53</li>
								<li th:text="${order.getReceiverName()}">杨小黄</li>
								<li>订单号:[[${order.getOrderId()}]]</li>
								<li>在线支付</li>
							</ul>
							<p class="fr">订单金额：<span th:text="${order.getTotalPrice()}">99.00</span>元</p>
						</div>
						<div class="shohou clearfix">
							<a href="#" class="fl"><img src="../../img/g1.jpg"/></a>
							<p class="fl"><a href="#">家用创意菜盘子圆盘 釉下彩复古</a><a href="#">¥99.00×1</a></p>
							<div style="display: none"> [[${order.getOrderId()}]]</div>
							<p class="fr">
								<a href="#">交易失败</a>
								<a href="#" class="toorderxq">订单详情</a>
							</p>
						</div>
					</div>
					<div class="fenye clearfix">
						<a href="#"><img src="../../img/zuo.jpg"/></a>
						<a href="#">1</a>
						<a href="#"><img src="../../img/you.jpg"/></a>
					</div>
				</div>
			</div>
		</div>
		<!--返回顶部-->
		<div class="gotop">
			<a href="cart">
			<dl>
				<dt><img src="../../img/gt1.png"/></dt>
				<dd>去购<br />物车</dd>
			</dl>
			</a>
			<a href="#" class="dh">
			<dl>
				<dt><img src="../../img/gt2.png"/></dt>
				<dd>联系<br />客服</dd>
			</dl>
			</a>
			<a href="mygxin">
			<dl>
				<dt><img src="../../img/gt3.png"/></dt>
				<dd>个人<br />中心</dd>
			</dl>
			</a>
			<a href="#" class="toptop" style="display: none">
			<dl>
				<dt><img src="../../img/gt4.png"/></dt>
				<dd>返回<br />顶部</dd>
			</dl>
			</a>
			<p>400-800-8200</p>
		</div>
		<!--footer-->
		<div class="footer">
			<div class="top">
				<div class="wrapper">
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot1.png"/></a>
						<span class="fl">7天无理由退货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot2.png"/></a>
						<span class="fl">15天免费换货</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot3.png"/></a>
						<span class="fl">满599包邮</span>
					</div>
					<div class="clearfix">
						<a href="#2" class="fl"><img src="../../img/foot4.png"/></a>
						<span class="fl">手机特色服务</span>
					</div>
				</div>
			</div>
			<p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br />
			违法和不良信息举报电话：188-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
		</div>
		<script src="../../js/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/user.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../../js/sweetalert.min.js"></script>
<script>
	$(document).ready(function () {
		// //获取cookie值
		// var str = document.cookie;
		// //将值切割成数组
		// var arr = str.split(";");
		// console.log(arr[0]);
		console.log("from code itself1")
		console.log("cookie中的avatar=" + $.cookie("photo"));
		$("#img-avatar").attr("src", $.cookie("photo"));

		$.ajax({
			url: "/getUserInfo",
			type: "GET",
			dataType: "json",
			success: function(json) {
				if (json.state == 200) {
					console.log("username=" + json.data.username);
					console.log("email=" + json.data.email);
					$("#username").val(json.data.username);
					$("#email").val(json.data.email);
					$("#usernameDouble").text(json.data.username)
				} else {
					alert("获取用户信息失败！" + json.message);
				}
			}
		});
	});



	//点击确认收货
	$('.confirmReceive').click(function () {
		var orderId=$(this).parent().prev().text().trim();
		var orderId = {
			"orderId": orderId
		};
		console.log(orderId);
		$.ajax({
			type: 'POST',
			url: '/front/confirmReceive',
			contentType: 'application/json',
			data: JSON.stringify(orderId),
			success:function (result) {
				if (result.code == 1){
					console.log("确认收货成功")
					swal({
						title: '确认收货',
						icon: 'success',
						text: result.message,
						button: {
							text: "确认",
							value: true,
						}
					}).then(function (isok) {
						if (isok) {
							// location.href='/front/myorderq';
							location.reload();
						}
					})

				}else {
					swal({
						title: '温馨提示',
						icon: 'warning',
						text: result.message,
						button: {
							text: "确认",
							value: true,
						}
					}).then(function (isok) {
						if (isok) {
							location.reload();
						}
					})
				}
			}

		});
	})
	//点击去支付
	$('.toPay').click(function () {
		var orderId=$(this).parent().prev().text().trim();
		var orderId = {
			"orderId": orderId
		};
		console.log(orderId);
		$.ajax({
			type: 'POST',
			url: '/front/toPay',
			contentType: 'application/json',
			data: JSON.stringify(orderId),
			success:function (result) {
				if (result.code == 1){
					console.log("确认收货成功")
					swal({
						title: '前往支付',
						icon: 'warning',
						text: result.message,
						button: {
							text: "确认",
							value: true,
						}
					}).then(function (isok) {
						if (isok) {
							location.href='/alipay/pay';
							// location.reload();
						}
					})

				}else {
					swal({
						title: '温馨提示',
						icon: 'warning',
						text: result.message,
						button: {
							text: "确认",
							value: true,
						}
					}).then(function (isok) {
						if (isok) {
							location.reload();
						}
					})
				}
			}

		});

	})
	//点击提醒发货
	$('.remindToSend').click(function () {
		swal({
			title: '提醒发货',
			icon: 'success',
			text: '成功发送信息提示卖家发货！',
			button: {
				text: "确认",
				value: true,
			}
		}).then(function (isok) {
			if (isok) {
				// location.href='/front/ok';
				location.reload();
			}
		})

	})

	$(".toorderxq").click(function () {
		var orderId=$(this).parent().prev().text().trim();
		var orderId = {
			"orderId": orderId
		};
		console.log(orderId);
		$.ajax({
			type: 'POST',
			url: '/front/searchOrderxq',
			contentType: 'application/json',
			data: JSON.stringify(orderId),
			success:function (result) {
				if (result.code == 1){
					console.log("确认查看订单详情成功")
					location.href="/front/orderxq"

				}else {
					swal({
						title: '温馨提示',
						icon: 'warning',
						text: result.message,
						button: {
							text: "确认",
							value: true,
						}
					}).then(function (isok) {
						if (isok) {
							location.reload();
						}
					})
				}
			}

		});

	})

	$('#waitToPayA').click(function () {
		$(".waitToPayDiv").show();
		$('.waitToReceiveDiv').hide();
		$('.alreadyReceiveDiv').hide();
		$('.notSendDiv').hide();
		$('.closeDiv').hide();
	})

	$('#waitToReceiveA').click(function () {
		$(".waitToPayDiv").hide();
		$('.waitToReceiveDiv').show();
		$('.alreadyReceiveDiv').hide();
		$('.notSendDiv').hide();
		$('.closeDiv').hide();
	})
	$('#alreadyReceiveA').click(function () {
		$(".waitToPayDiv").hide();
		$('.waitToReceiveDiv').hide();
		$('.alreadyReceiveDiv').show();
		$('.notSendDiv').hide();
		$('.closeDiv').hide();
	})
	$('#notSendA').click(function () {
		$(".waitToPayDiv").hide();
		$('.waitToReceiveDiv').hide();
		$('.alreadyReceiveDiv').hide();
		$('.notSendDiv').show();
		$('.closeDiv').hide();
	})
	$('#closeA').click(function () {
		$(".waitToPayDiv").hide();
		$('.waitToReceiveDiv').hide();
		$('.alreadyReceiveDiv').hide();
		$('.notSendDiv').hide();
		$('.closeDiv').show();
	})
	$('#allOrdersA').click(function () {
		$(".waitToPayDiv").show();
		$('.waitToReceiveDiv').show();
		$('.alreadyReceiveDiv').show();
		$('.notSendDiv').show();
		$('.closeDiv').show();
	})




</script>
	</body>
</html>
